package com.ljq.rpc.client.condition;

import com.ljq.rpc.client.config.ClientConfig;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.io.IOException;
import java.io.InputStream;


public class ClientCondition implements Condition {

    private static String property;

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        if(property==null){
            Environment environment = context.getEnvironment();
            property = environment.getProperty("rpc.job");
        }
        return property.equals("client");
    }

}
